home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / SOURCES / WBITMAP.C < prev    next >
C/C++ Source or Header  |  1980-01-22  |  16KB  |  601 lines

  1. /*
  2.  *  MS - dependent bitmap code
  3.  */
  4.  
  5. #include <Interviews\bitmap.h>
  6. #include <Interviews\font.h>
  7. #include <Interviews\transformer.h>
  8. #include <Interviews\X11\painterrep.h>
  9. #include <Interviews\X11\worldrep.h>
  10. #include <math.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #include <stdio.h>
  14. #include <dir.h>
  15. #include <fstream.h>
  16.  
  17. static int BitmapSize (unsigned int w, unsigned int h) {
  18.     return (w+7)/8 * h;
  19. }
  20.  
  21. int hextoi (char* s) {
  22.     int result;
  23.     sscanf(s, "%x", &result);
  24.     return result;
  25. }
  26.  
  27. /*
  28.  *  Steps through an X Bitmap File and collects extracted values in an 
  29.  *  array.
  30.  */
  31.  
  32. int BitmapRep::ParseBitmapFile (const char* filename, char** data) {
  33.     ifstream source;
  34.  
  35.     char* file;
  36.     if ((file = searchpath(filename)) == NULL) {
  37.     return 0;
  38.     }
  39.     source.open(file, ios::nocreate);
  40.     if (!source) {
  41.     int a;
  42.     a = 1;
  43.     } else {
  44.     char buf[256];
  45.     char* ptr;
  46.  
  47.     source.getline(buf, 256);
  48.     if ((ptr = strstr(buf, "width")) != NULL) {
  49.         ptr = strpbrk(ptr, "0123456789");
  50.         width = atoi(ptr);
  51.     }
  52.  
  53.     source.getline(buf, 256);
  54.     if ((ptr = strstr(buf, "height")) != NULL) {
  55.         ptr = strpbrk(ptr, "0123456789");
  56.         height = atoi(ptr);
  57.     }
  58.  
  59.     source.getline(buf, 256);
  60.     if ((ptr = strstr(buf, "x_hot")) != NULL) {
  61.         ptr = strpbrk(ptr, "0123456789");
  62.         x0 = atoi(ptr);
  63.         source.getline(buf, 256);
  64.     }
  65.  
  66.     if ((ptr = strstr(buf, "y_hot")) != NULL) {
  67.         ptr = strpbrk(ptr, "0123456789");
  68.         y0 = atoi(ptr);
  69.         source.getline(buf, 256);
  70.     }
  71.  
  72.     int size = BitmapSize(width, height);
  73.     char* d = new char[size];
  74.     int index = 0;
  75.     do {
  76.         ptr = buf;
  77.         while ((ptr = strstr(ptr, "0x")) != NULL) {
  78.         d[index++] = hextoi(ptr);
  79.         ptr++;
  80.         }
  81.         source.getline(buf, 256);
  82.     } while (!source.eof());
  83.     *data = d;
  84.     return 1;
  85.     }
  86. }
  87.  
  88. int BitmapDataSize (int width, int height) {
  89.     return ((width/16 + 1)*height);
  90. }
  91.  
  92. /*
  93.  * A data byte of an X Bitmap must be reflected to get the Windows Format.
  94.  */
  95.  
  96. unsigned BitmapRep::ReflectByte (unsigned value) {
  97.     unsigned sbit, dbit, result = 0;
  98.  
  99.     for (int i = 0; i < 8; i++) {
  100.     sbit = 1 << i;
  101.     dbit = 128 >> i;
  102.     if (sbit & value) {
  103.         result += dbit;
  104.     }
  105.     }
  106.     return result;
  107. }
  108.  
  109. /*
  110.  * Organizes an incoming data array to Windows Format. The width and height 
  111.  * of a Windows Bitmap are always multiples of 16. X organizes his bitmaps 
  112.  * as a continous byte stream. 2 byte units must be created.
  113.  */
  114.  
  115. void BitmapRep::CreateWinFormat (char* data,  unsigned** newdata) {
  116.     int column, row = 0;
  117.     int j = 0, i = 0;
  118.     boolean high;
  119.     unsigned value;
  120.  
  121.     unsigned* d = new unsigned[BitmapDataSize(width, height)];
  122.     while (row < height) {
  123.     column = 0;
  124.     high = false;
  125.     while (column < width) {
  126.         column += 8;
  127.         value = ReflectByte(data[i]);
  128.         i++;
  129.         if (high) {
  130.         d[j] += value << 8;
  131.         high = false;
  132.         j++;
  133.         } else {
  134.         d[j] = value;
  135.         high = true;
  136.         }
  137.     }
  138.     if (high) {
  139.         j++;
  140.     }
  141.     row++;
  142.     }
  143.     *newdata = d;
  144. }
  145.  
  146. boolean BitmapRep::IsWinFormat (const char* filename) {
  147.     if (strstr(filename, ".bmp")) {
  148.     return true;
  149.     }
  150.     return false;
  151. }
  152.  
  153. /* 
  154.  * Returns width, height of the bitmap.
  155.  */
  156.  
  157. void BitmapRep::GetBitmapExt () {
  158.     HDC hMemDC = CreateCompatibleDC(NULL);
  159.     HBITMAP holdBitmap = SelectObject(hMemDC, (HBITMAP)map);
  160.     RECT rect;
  161.     GetClipBox(hMemDC, &rect);
  162.     width = rect.right;
  163.     height = rect.bottom;
  164.     SelectObject(hMemDC, holdBitmap);
  165.     DeleteDC(hMemDC);
  166. }
  167.  
  168. BitmapRep::BitmapRep (const char* filename) {
  169.     if (IsWinFormat(filename)) {
  170.     map = (void*)LoadBitmap(_world->hinstance(), (LPSTR)filename);
  171.     GetBitmapExt();
  172.     } else {
  173.     char* data;
  174.     unsigned* windata;
  175.     ParseBitmapFile(filename, &data);
  176.     CreateWinFormat(data, &windata);
  177.     map = (void*)CreateBitmap (width, height, 1, 1, (LPSTR)windata);
  178.     delete data;
  179.     delete windata;
  180.     data = nil;
  181.     }
  182.     data = nil;
  183. }
  184.  
  185. BitmapRep::BitmapRep (
  186.     char* d, unsigned int w, unsigned int h, int x, int y
  187. ) {
  188.     unsigned* newd;
  189.     width = w; height = h;
  190.     x0 = x; y0 = y;
  191.  
  192.     CreateWinFormat(d, &newd);
  193.     map = (void*)CreateBitmap (w, h, 1, 1, (LPSTR)newd);
  194.     delete newd;
  195.     data = nil;
  196. }
  197.  
  198. BitmapRep::BitmapRep (Font* f, int c) {
  199.     HDC hMemDC = CreateCompatibleDC(NULL);
  200.     if (!f->Valid()) {
  201.     return;
  202.     }
  203.     HFONT holdFont = SelectObject(hMemDC, (HFONT)f->Id());
  204.     width = GetTextExtent(hMemDC, (char*)&c, 1);
  205.     height = f->Height();
  206.     x0 = 0; y0 = 0;
  207.     map = (void*)CreateBitmap (width, height, 1, 1, NULL);
  208.     HBITMAP holdBitmap = SelectObject(hMemDC, (HBITMAP)map);
  209.     TextOut(hMemDC, 0, 0, (LPSTR)&c, 1);
  210.     SelectObject(hMemDC, holdFont);
  211.     SelectObject(hMemDC, holdBitmap);
  212.     DeleteDC(hMemDC);
  213.     data = nil;
  214. }
  215.  
  216. BitmapRep::BitmapRep (BitmapRep* b, BitTx t) {
  217.     switch (t) {
  218.     case NoTx: case FlipH: case FlipV: case Rot180: case Inv:
  219.     width = b->width; height = b->height; break;
  220.     case Rot90: case Rot270:
  221.     width = b->height; height = b->width; break;
  222.     }
  223.     x0 = b->x0;
  224.     y0 = b->y0;
  225.  
  226.     map = (void*)CreateBitmap(width, height, 1, 1, NULL);
  227.  
  228.     for (int x = 0; x < width; ++x) {
  229.     for (int y = 0; y < height; ++y) {
  230.         boolean bit;
  231.         switch(t) {
  232.         case NoTx:   bit = b->GetBit(x, y); break;
  233.         case FlipH:  bit = b->GetBit(width-x-1, y); break;
  234.         case FlipV:  bit = b->GetBit(x, height-y-1); break;
  235.         case Rot90:  bit = b->GetBit(height-y-1, x); break;
  236.         case Rot180: bit = b->GetBit(width-x-1, height-y-1); break;
  237.         case Rot270: bit = b->GetBit(y, width-x-1); break;
  238.         case Inv:    bit = !b->GetBit(x, y); break;
  239.         }
  240.         PutBit(x, y, bit);
  241.     }
  242.     }
  243. }
  244.  
  245. /*----------------------------------------------------------------------*/
  246.  
  247. static void DrawSourceTransformedImage (
  248.     HBITMAP s, int sx0, int sy0,
  249.     HBITMAP m, int mx0, int my0,
  250.     HWND d, unsigned int height, int dx0, int dy0,
  251.     boolean stencil, COLORREF fg, COLORREF bg,
  252.     HDC hDC, Transformer* matrix,
  253.     int xmin, int ymin, int xmax, int ymax,
  254.     int s_width, int s_height,
  255.     int m_width, int m_height
  256. ) {
  257.     HDC hmDC = CreateCompatibleDC(hDC);
  258.     HDC hsDC = CreateCompatibleDC(hDC);
  259.     HBITMAP holdBitmap_s = SelectObject(hsDC, s);
  260.     HBITMAP holdBitmap_m = SelectObject(hmDC, m);
  261.  
  262.     COLORREF lastdrawnpixel = fg;
  263.     for (int xx = xmin; xx <= xmax; ++xx) {
  264.     float lx, ly;
  265.     float rx, ry;
  266.     float tx, ty;
  267.     matrix->Transform(float(xx), float(ymin), lx, ly);
  268.     matrix->Transform(float(xx + 1), float(ymin), rx, ry);
  269.     matrix->Transform(float(xx), float(ymax+1), tx, ty);
  270.     float dx = (tx - lx) / float(ymax - ymin + 1);
  271.     float dy = (ty - ly) / float(ymax - ymin + 1);
  272.     int ilx = 0, ily = 0;
  273.     int irx = 0, iry = 0;
  274.     boolean lastmask = false, mask;
  275.     COLORREF lastpixel = fg, pixel, source;
  276.     for (int yy = ymin; yy <= ymax+1; ++yy) {
  277.         mask = (
  278.         (yy <= ymax)
  279.         && (m == nil || GetPixel(hmDC, xx-mx0, m_height-1-(yy-my0) != -1))
  280.         );
  281.         if (
  282.         yy<sy0 || yy>=sy0+s_height || xx<sx0 || xx>=sx0+s_width
  283.         ) {
  284.         source = bg;
  285.         } else {
  286.         DWORD rgb = GetPixel(hsDC, xx-sx0, s_height-1-(yy-sy0));
  287.         source = PALETTERGB(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
  288.         }
  289.         if (stencil) {
  290.         pixel = (source != 0x2000000) ? fg : bg;
  291.         } else {
  292.         pixel = source;
  293.         }
  294.         if (mask != lastmask || lastmask && pixel != lastpixel) {
  295.         int iilx = round(lx), iily = round(ly);
  296.         int iirx = round(rx), iiry = round(ry);
  297.         if (lastmask) {
  298.             if (lastpixel != lastdrawnpixel) {
  299.             SetTextColor(hDC, lastpixel);
  300.             lastdrawnpixel = lastpixel;
  301.             }
  302.             if (
  303.             (ilx==iilx || ily==iily) && (irx==ilx || iry==ily)
  304.             ) {
  305.             HBRUSH hBrush = CreateSolidBrush(lastpixel);
  306.             RECT rect;
  307.             rect.left   = min(ilx, iirx) - dx0;
  308.             rect.top    = height - (max(ily, iiry) - dy0);
  309.             rect.right  = rect.left + abs(ilx - iirx);
  310.             rect.bottom = rect.top + abs(ily - iiry);
  311.             ::FillRect(hDC, &rect, hBrush);
  312.             DeleteObject(hBrush);
  313.             } else {
  314.             POINT v[4];
  315.             v[0].x = ilx-dx0;  v[0].y = height - (ily-dy0);
  316.             v[1].x = iilx-dx0; v[1].y = height - (iily-dy0);
  317.             v[2].x = iirx-dx0; v[2].y = height - (iiry-dy0);
  318.             v[3].x = irx-dx0;  v[3].y = height - (iry-dy0);
  319.             HBRUSH hBrush    = CreateSolidBrush(lastpixel);
  320.             HPEN   hPen      = GetStockObject(NULL_PEN);
  321.             HBRUSH holdBrush = SelectObject(hDC, hBrush);
  322.             HPEN   holdPen   = SelectObject(hDC, hPen);
  323.             ::Polygon(hDC, v, 4);
  324.             SelectObject(hDC, holdPen);
  325.             SelectObject(hDC, holdBrush);
  326.             DeleteObject(hBrush);
  327.             }
  328.         }
  329.         ilx = iilx; ily = iily;
  330.         irx = iirx; iry = iiry;
  331.         lastpixel = pixel;
  332.         lastmask = mask;
  333.         }
  334.         lx += dx; ly += dy;
  335.         rx += dx; ry += dy;
  336.     }
  337.     }
  338.     SetTextColor(hDC, fg);
  339.  
  340.     SelectObject(hsDC, holdBitmap_s);
  341.     SelectObject(hmDC, holdBitmap_m);
  342.     DeleteDC(hsDC);
  343.     DeleteDC(hmDC);
  344. }
  345.  
  346. static void DrawDestinationTransformedImage (
  347.     HBITMAP s, int sx0, int sy0,
  348.     HBITMAP m, int mx0, int my0,
  349.     HWND d, unsigned int height, int dx0, int dy0,
  350.     boolean stencil, COLORREF fg, COLORREF bg,
  351.     HDC hDC, Transformer* matrix,
  352.     int xmin, int ymin, int xmax, int ymax,
  353.     int s_width, int s_height,
  354.     int m_width, int m_height
  355. ) {
  356.     HBRUSH holdBrush;
  357.     HDC hmDC = CreateCompatibleDC(hDC);
  358.     HDC hsDC = CreateCompatibleDC(hDC);
  359.     HBITMAP holdBitmap_m = SelectObject(hmDC, m);
  360.     HBITMAP holdBitmap_s = SelectObject(hsDC, s);
  361.  
  362.  
  363.     Transformer t(matrix);
  364.     t.Invert();
  365.  
  366.     COLORREF lastdrawnpixel = fg;
  367.     for (Coord xx = xmin; xx <= xmax; ++xx) {
  368.     float fx, fy;
  369.     float tx, ty;
  370.     t.Transform(float(xx) + 0.5, float(ymin) + 0.5, fx, fy);
  371.     t.Transform(float(xx) + 0.5, float(ymax) + 1.5, tx, ty);
  372.     float dx = (tx - fx) / float(ymax - ymin + 1);
  373.     float dy = (ty - fy) / float(ymax - ymin + 1);
  374.     Coord lasty = ymin;
  375.     boolean lastmask = false, mask;
  376.     COLORREF lastpixel = fg, pixel, source;
  377.     for (Coord yy = ymin; yy <= ymax+1; ++yy) {
  378.         int ix = round(fx - 0.5), iy = round(fy - 0.5);
  379.         boolean insource = (
  380.            ix >= sx0 && ix < sx0 + s_width
  381.            && iy >= sy0 && iy < sy0 + s_height
  382.         );
  383.         boolean inmask = (
  384.         m != nil && ix >= mx0 && ix < mx0 + m_width
  385.         && iy >= my0 && iy < my0 + m_height
  386.         );
  387.         if (yy <= ymax) {
  388.         if (m == nil) {
  389.             mask = insource;
  390.         } else if (inmask) {
  391.             mask = GetPixel(hmDC, ix-mx0, m_height-1-(iy-my0)) != -1;
  392.         } else {
  393.             mask = false;
  394.         }
  395.         } else {
  396.         mask = false;
  397.         }
  398.         if (insource) {
  399.         DWORD rgb = GetPixel(hsDC, ix-sx0, s_height-1-(iy-sy0));
  400.         source = PALETTERGB(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
  401.         } else {
  402.         source = bg;
  403.         }
  404.         if (stencil) {
  405.         pixel = (source != 0x2000000) ? fg : bg;
  406.         } else {
  407.         pixel = source;
  408.         }
  409.         if (mask != lastmask || lastmask && pixel != lastpixel) {
  410.         if (lastmask) {
  411.             if (lastpixel != lastdrawnpixel) {
  412.             SetTextColor(hDC, lastpixel);
  413.             lastdrawnpixel = lastpixel;
  414.             }
  415.             HBRUSH hBrush = CreateSolidBrush(lastpixel);
  416.             RECT rect;
  417.             rect.left = xx - dx0;
  418.             rect.top = height -1 -(yy -dy0);
  419.             rect.right = rect.left + 1;
  420.             rect.bottom = rect.top + (yy - lasty);
  421.             FillRect(hDC, &rect, hBrush);
  422.             DeleteObject(hBrush);
  423.         }
  424.         lastmask = mask;
  425.         lastpixel = pixel;
  426.         lasty = yy;
  427.         }
  428.         fx += dx;
  429.         fy += dy;
  430.     }
  431.     }
  432.     SetTextColor(hDC, fg);
  433.  
  434.     SelectObject(hsDC, holdBitmap_s);
  435.     SelectObject(hmDC, holdBitmap_m);
  436.     DeleteDC(hsDC);
  437.     DeleteDC(hmDC);
  438. }
  439.  
  440. void DrawTransformedImage (
  441.     HBITMAP s, int sx0, int sy0,
  442.     HBITMAP m, int mx0, int my0,
  443.     HWND d, unsigned int height, int dx0, int dy0,
  444.     boolean stencil, COLORREF fg, COLORREF bg,
  445.     HDC hDC, Transformer* matrix,
  446.     int s_width, int s_height,
  447.     int m_width, int m_height
  448. ) {
  449.     int x1 = (m != nil) ? mx0 : sx0;
  450.     int y1 = (m != nil) ? my0 : sy0;
  451.     int x2 = (m != nil) ? mx0 : sx0;
  452.     int y2 = (m != nil) ? my0 + m_height : sy0 + s_height;
  453.     int x3 = (m != nil) ? mx0 + m_width : sx0 + s_width;
  454.     int y3 = (m != nil) ? my0 + m_height : sy0 + s_height;
  455.     int x4 = (m != nil) ? mx0 + m_width : sx0 + s_width;
  456.     int y4 = (m != nil) ? my0 : sy0;
  457.  
  458.     int sxmin = min(x1, min(x2, min(x3, x4)));
  459.     int sxmax = max(x1, max(x2, max(x3, x4))) - 1;
  460.     int symin = min(y1, min(y2, min(y3, y4)));
  461.     int symax = max(y1, max(y2, max(y3, y4))) - 1;
  462.  
  463.     matrix->Transform(x1, y1);
  464.     matrix->Transform(x2, y2);
  465.     matrix->Transform(x3, y3);
  466.     matrix->Transform(x4, y4);
  467.  
  468.     int dxmin = min(x1,min(x2,min(x3,x4)));
  469.     int dxmax = max(x1,max(x2,max(x3,x4))) - 1;
  470.     int dymin = min(y1,min(y2,min(y3,y4)));
  471.     int dymax = max(y1,max(y2,max(y3,y4))) - 1;
  472.  
  473.     int swidth = sxmax - sxmin + 1;
  474.     int sheight = symax - symin + 1;
  475.     int dwidth = dxmax - dxmin + 1;
  476.     int dheight = dymax - dymin + 1;
  477.  
  478.     boolean rect = (x1==x2 || y1==y2) && (x1==x4 || y1==y4);
  479.     boolean alwaysdest = dwidth < 2 * swidth;
  480.     boolean alwayssource = dwidth * dheight > 3 * swidth * sheight;
  481.     boolean dest;
  482.  
  483.     dest = alwaysdest || (!alwayssource && !rect);
  484.  
  485.     if (dest) {
  486.     if (dheight > 0) {
  487.         DrawDestinationTransformedImage(
  488.         s, sx0, sy0, m, mx0, my0, d, height, dx0, dy0,
  489.         stencil, fg, bg, hDC, matrix,
  490.         dxmin, dymin, dxmax, dymax,
  491.         s_width, s_height,
  492.         m_width, m_height
  493.         );
  494.     }
  495.     } else {
  496.     if (sheight > 0) {
  497.         DrawSourceTransformedImage(
  498.         s, sx0, sy0, m, mx0, my0, d, height, dx0, dy0,
  499.         stencil, fg, bg, hDC, matrix,
  500.         sxmin, symin, sxmax, symax,
  501.         s_width, s_height,
  502.         m_width, m_height
  503.         );
  504.     }
  505.     }
  506. }
  507.  
  508. BitmapRep::BitmapRep (BitmapRep* b, Transformer* matrix) {
  509.     Transformer t(matrix);
  510.  
  511.     Coord x1 = - b->x0;
  512.     Coord y1 = - b->y0;
  513.     Coord x2 = - b->x0;
  514.     Coord y2 = b->height - b->y0;
  515.     Coord x3 = b->width - b->x0;
  516.     Coord y3 = b->height - b->y0;
  517.     Coord x4 = b->width - b->x0;
  518.     Coord y4 = - b->y0;
  519.  
  520.     t.Transform(x1, y1);
  521.     t.Transform(x2, y2);
  522.     t.Transform(x3, y3);
  523.     t.Transform(x4, y4);
  524.  
  525.     Coord xmax = max(x1,max(x2,max(x3,x4))) - 1;
  526.     Coord xmin = min(x1,min(x2,min(x3,x4)));
  527.     Coord ymax = max(y1,max(y2,max(y3,y4))) - 1;
  528.     Coord ymin = min(y1,min(y2,min(y3,y4)));
  529.  
  530.     int w = xmax - xmin + 1;
  531.     int h = ymax - ymin + 1;
  532.     width = (w <= 0) ? 1 : w;
  533.     height = (h <= 0) ? 1 : h;
  534.     x0 = -xmin;
  535.     y0 = -ymin;
  536.  
  537.     HDC hMemDC = CreateCompatibleDC(NULL);
  538.     map = (void*)CreateBitmap(width, height, 1, 1, NULL);
  539.     HBITMAP holdBitmap = SelectObject(hMemDC, (HBITMAP)map);
  540.     PatBlt(hMemDC, 0, 0, width, height, WHITENESS);
  541.     DrawTransformedImage(
  542.     (HBITMAP)b->GetData(), -b->x0, -b->y0,
  543.     (HBITMAP)b->GetData(), -b->x0, -b->y0,
  544.     (HBITMAP)map, height, -x0, -y0,
  545.     true, 1, 0, hMemDC, &t,
  546.     b->width, b->height,
  547.     b->width, b->height
  548.     );
  549.     SelectObject(hMemDC, holdBitmap);
  550.     DeleteDC (hMemDC);
  551.     data = nil;
  552. }
  553.  
  554. BitmapRep::~BitmapRep () {
  555.     Touch();
  556. }
  557.  
  558. void BitmapRep::Touch () {
  559. /*    if (map != nil) {
  560.     DeleteObject((HBITMAP)map);
  561.     map = nil;
  562.     }
  563. */
  564. }
  565.  
  566. void BitmapRep::PutBit (int x, int y, boolean bit) {
  567.     HDC hMemDC = CreateCompatibleDC(NULL);
  568.     HBITMAP holdBitmap = SelectObject(hMemDC, (HBITMAP)map);
  569.     if (bit) {
  570.     SetPixel(hMemDC, x, y, RGB(255, 255, 255));
  571.     } else {
  572.     SetPixel(hMemDC, x, y, RGB(0, 0, 0));
  573.     }
  574.     SelectObject(hMemDC, holdBitmap);
  575.     DeleteDC(hMemDC);
  576. }
  577.  
  578. boolean BitmapRep::GetBit (int x, int y) {
  579.     boolean result;
  580.  
  581.     HDC hMemDC = CreateCompatibleDC(NULL);
  582.     HBITMAP holdBitmap = SelectObject(hMemDC, (HBITMAP)map);
  583.     if (GetPixel(hMemDC, x, y) != 0xFFFFFF) {
  584.     result = false;
  585.     } else {
  586.     result = true;
  587.     }
  588.     SelectObject(hMemDC, holdBitmap);
  589.     DeleteDC(hMemDC);
  590.     return result;
  591. }
  592.  
  593. void* BitmapRep::GetData () {
  594.     return map;
  595. }
  596.  
  597. void* BitmapRep::GetMap () {
  598.     return map;
  599. }
  600.  
  601.